<template>
  <div class="hotCardWrap">
    <div class="title">{{ title }}</div>
    <div
      class="showList"
      v-for="item in tracks"
      :key="item.albumId"
      @click="toDetail(item.albumId)"
    >
      <div class="hotImg">
        <img :src="item.albumCoverPath" alt="" />
        <div class="icon"><van-icon name="play" /></div>
      </div>
      <div class="content">
        <div class="subTitle">
          {{ item.title }}
        </div>
        <div class="userName">
          <span><van-icon name="user-o" /> {{ item.anchorName }}</span>
          <span
            ><van-icon name="service-o" />
            {{ useFormatPlayCount(item.playCount) }}</span
          >
        </div>
      </div>
    </div>
  </div>
</template>

<script lang="ts">
import { defineComponent } from 'vue';

export default defineComponent({
  name: 'scz-hot-card',
});
</script>

<script setup lang="ts">
import { useRouter } from 'vue-router';
import {useFormatPlayCount} from '@/mixin/playCount'
const router = useRouter();

 defineProps(['title', 'tracks']);

function toDetail(albumId:number) {
  router.push('/detail/'+albumId);
}
</script>

<style scoped lang="less">
.hotCardWrap {
  padding: 15px 15px 22px;
  .title {
    margin-bottom: 15px;
    font-size: 18px;
    font-weight: 600;
    color: #333;
  }

  .showList {
    padding: 15px 0;
    display: flex;
    justify-content: space-between;

    .hotImg {
      position: relative;
      width: 70px;
      height: 70px;
      flex: 0 0 auto;
      overflow: hidden;
      border-radius: 10px;
      img {
        width: 100%;
        height: 100%;
      }
      .icon {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        line-height: 70px;
        text-align: center;
        vertical-align: center;
        background: rgba(105, 105, 105, 0.512);
        color: #fff;
      }
    }

    .content {
      width: 260px;
      height: 70px;
      font-size: 16px;
      .subTitle {
        margin-bottom: 5px;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
      }
      .userName {
        font-size: 12px;
        color: #999;
        span {
          padding-right: 15px;
        }
      }
    }
  }
}
</style>
